UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'osAmBD+JTjND+r8MudjOf4sKtoUL5wrFe3H+Xr3qSRY='
WHERE
key_id = 'f5c9a108b0a1bcafe951cd17f48ea11185617e2de71a96608c4bafc4c644c378'
AND (
token = 'osAmBD+JTjND+r8MudjOf4sKtoUL5wrFe3H+Xr3qSRY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)