UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kIDekC3pcTU4M4ZjwVJGhiGpHexBKZp7aro3pxg6R7w=' 
WHERE 
  key_id = 'c551da52bb716f97593a17da10afbbe150bd8d3237cc881bc4351bf334561100' 
  AND (
    token = 'kIDekC3pcTU4M4ZjwVJGhiGpHexBKZp7aro3pxg6R7w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00087