UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r4S0crXQPg/UdBD9CySF//0t7kcsLXhyIKXuk0bv/Xs='
WHERE
key_id = 'ffb76ea1ec8743551410a4f020751e936fe4f2b2d0f207d485369605b838240c'
AND (
token = 'r4S0crXQPg/UdBD9CySF//0t7kcsLXhyIKXuk0bv/Xs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)