UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9RTY5eoS7I2KDziKHLPvVc+8ZapTamUYDmVqTKyRsXI='
WHERE
key_id = 'd9b255b2ddb26b9c4d0287bc1ab20b6d55f2f43bd7292e8395edd70bf85ebff5'
AND (
token = '9RTY5eoS7I2KDziKHLPvVc+8ZapTamUYDmVqTKyRsXI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)