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