UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rnYCAQZ4Zm1ktIVkAeCW9J97qIuucv5sQeBELPVfSX8='
WHERE
key_id = '05a5e55c6649a7a4cb909c9501c0fc8e77d4f78461061061a5512da74fa1fced'
AND (
token = 'rnYCAQZ4Zm1ktIVkAeCW9J97qIuucv5sQeBELPVfSX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)