UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kCRysm1UBLfBfsMGaDhBvGlh6eOu/SHoV7cT8hIeEU8='
WHERE
key_id = 'd551047ae0d8031446ece27a457858cab1b699a5499d221da86c3a6c90495873'
AND (
token = 'kCRysm1UBLfBfsMGaDhBvGlh6eOu/SHoV7cT8hIeEU8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)