UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uguH60NEBuwg8DVBpLep7+30rD0y96EhPgjWXOKny1s=' 
WHERE 
  key_id = 'b8e267a6d4d0279a9b63da5a9fb0cf0fd38b7cba8d372b55eca7ed9fcca40ba0' 
  AND (
    token = 'uguH60NEBuwg8DVBpLep7+30rD0y96EhPgjWXOKny1s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059