UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bHmt6sz1eVY8cib9FTWijJ2ZmD6uo2hUV/Ouhl2WNHg='
WHERE
key_id = 'b1a787697c9f85112676870b3783d544f3350e83215957323a1ac7b8f154f31d'
AND (
token = 'bHmt6sz1eVY8cib9FTWijJ2ZmD6uo2hUV/Ouhl2WNHg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)