UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R55cJawDimwkhgrNSqMxayHZiXoXIaHTvESQHN+cubg=' 
WHERE 
  key_id = '732cca54ac24164d2d3c34322e7ebcdcd7495893c1f463a2561ca8879cbeb7f7' 
  AND (
    token = 'R55cJawDimwkhgrNSqMxayHZiXoXIaHTvESQHN+cubg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031