UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F0unLvoweqwtrJ23DYVhgZV6RP+mrMcX843ZbkXHCAw=' 
WHERE 
  key_id = '9e8281710dc0042cd1ae5800a69bad67caad0eeb54e7487d7e7181649612484c' 
  AND (
    token = 'F0unLvoweqwtrJ23DYVhgZV6RP+mrMcX843ZbkXHCAw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041