UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5c4SpPcgU4WqoI9apnQvBLYd7WuUd0xJJEm55jg4kz4='
WHERE
key_id = '854b9c99a55f016107017e48f4caec608e427307883fcc973c821bacd224045f'
AND (
token = '5c4SpPcgU4WqoI9apnQvBLYd7WuUd0xJJEm55jg4kz4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)