UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lVYPX8eX1ahx+lledfkAx35XKHrXXsLGHqwtAN1v8Cw='
WHERE
key_id = 'd1d465d971f82e66454baf1e78d25caaffb51b9e35b713ee757d51e8beed3ccb'
AND (
token = 'lVYPX8eX1ahx+lledfkAx35XKHrXXsLGHqwtAN1v8Cw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)