UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gUj8fSpw/l4s+j9OeiEskKTsozSu9ybI00NUL3WgDM8=' 
WHERE 
  key_id = '38e452bb44364cabcddbdce453a939f073dd6f89a32594cac92a843a892ae3ff' 
  AND (
    token = 'gUj8fSpw/l4s+j9OeiEskKTsozSu9ybI00NUL3WgDM8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029