UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'scypwkenZAYPTL1erNPa0wlXSfstrlCM7fW5wTQzwF4='
WHERE
key_id = 'bfdc2c6405d8f40b4965f0c6996d005085617b0a4ee747efc9c1495ca2ab06b3'
AND (
token = 'scypwkenZAYPTL1erNPa0wlXSfstrlCM7fW5wTQzwF4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)