UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3mrtAQKo5iaewsXt85zSQ0SqU0PmYOO9M5DKtceZ2sw='
WHERE
key_id = 'a1e0f0636357d9c3c29a4e548a79787a876fde254d90c03f79bd07b2fa1014cf'
AND (
token = '3mrtAQKo5iaewsXt85zSQ0SqU0PmYOO9M5DKtceZ2sw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)