UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4GAvGvv4hyJAnvs85Zi3lgdG39NYj7z43TGFITuiOkw=' 
WHERE 
  key_id = '6e7632da27cf0a3fc01d01dfb2d8f25b90e89c22071857f4a0250e0c64747df7' 
  AND (
    token = '4GAvGvv4hyJAnvs85Zi3lgdG39NYj7z43TGFITuiOkw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043