UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ouhLSsfoX85G+H2HFtz81+xVFXMcLM5jl0qLpG2Vgug='
WHERE
key_id = 'f4b2824d443f4c9edd863f7516069f29766148972962a54940e87a6ae043c405'
AND (
token = 'ouhLSsfoX85G+H2HFtz81+xVFXMcLM5jl0qLpG2Vgug='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)