UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8R9xKTc2xCFIX7twa8L91+ACunEeZWCVXcPQCqCTpwM='
WHERE
key_id = '605f65951252ac5e6a6204d50c43389928172d277902ec034c8ba762c995113a'
AND (
token = '8R9xKTc2xCFIX7twa8L91+ACunEeZWCVXcPQCqCTpwM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)