UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5pMBgtQkAr7kXf2bKZ9hX3OOcmGAVmE3K7UyeykCe6g='
WHERE
key_id = '85c9745a1c49121963597d28689e5200f295e93dd41211222db843b3fec63489'
AND (
token = '5pMBgtQkAr7kXf2bKZ9hX3OOcmGAVmE3K7UyeykCe6g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)