UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EhD4PdM8mLFpEH0AdiNBFUsAbWrp6b6yC6TVdn7784M='
WHERE
key_id = '4db0d06578dcbabba5ba7f635449b234efa904b660eeedc681a4e86b9e1c8371'
AND (
token = 'EhD4PdM8mLFpEH0AdiNBFUsAbWrp6b6yC6TVdn7784M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)