UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YW8LJ6zlUyz4AhvosKWlmUFiPoLVQ4gKNIKO85wxD5k='
WHERE
key_id = '644c22949218686951db9726c496c4bf5e350f850e7896096d64b30ea74f3146'
AND (
token = 'YW8LJ6zlUyz4AhvosKWlmUFiPoLVQ4gKNIKO85wxD5k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)