UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jIPAM1bPAXmp0axDEq3JTpIF5E/MPyar69UNvm9X1/w='
WHERE
key_id = 'd31875e68a22a77884868e771c1ce392a60126ae7eec89b4376d615d8dba96d1'
AND (
token = 'jIPAM1bPAXmp0axDEq3JTpIF5E/MPyar69UNvm9X1/w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)