UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lCgO8qTNUl7woil9iNdMAB96o/LJErn1MQsmlDV4RHA='
WHERE
key_id = 'b810e0e262645e2a22228d66b4b14331e3e4cde73f9ee55ffbc1d5e0fa7321a1'
AND (
token = 'lCgO8qTNUl7woil9iNdMAB96o/LJErn1MQsmlDV4RHA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)