UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EYjSQbP9GXUco1KOHxUlC0AtWXq6tk2KTSJritgXfmg='
WHERE
key_id = '741eb9a3683c98e04f954a8e37f1e709f6929ad1e90abf8f7b6af42e13c74269'
AND (
token = 'EYjSQbP9GXUco1KOHxUlC0AtWXq6tk2KTSJritgXfmg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)