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

Query time 0.00055