UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OZN/iKLsKRE94B+WAYUI4p0Xn71pjenWkcrJ+d4cwHs='
WHERE
key_id = '40d8946079a66ed4915962234767d38928e6925b236b67964851cfb1ae7ad4b9'
AND (
token = 'OZN/iKLsKRE94B+WAYUI4p0Xn71pjenWkcrJ+d4cwHs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)