UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z+Pndr/xi51fRWqXC1RFNERgKbM8x5zF8j8U9U1vb9k='
WHERE
key_id = 'efb54b62b0e8370f6b7fe9841f7ece4c3b7cc031f7830601e0568faede04e469'
AND (
token = 'z+Pndr/xi51fRWqXC1RFNERgKbM8x5zF8j8U9U1vb9k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)