UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NLt5vOUPtOboK5uK76PTZrTX1Y+rFv1L4mia96gnSxE='
WHERE
key_id = 'bdf23a8b6bc74b72f49c0fe65d72a59e3adbf15582f7b015613095ee9ad46314'
AND (
token = 'NLt5vOUPtOboK5uK76PTZrTX1Y+rFv1L4mia96gnSxE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)