UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gBsTRHapeu+2VTJcDlK40HjfZ6fSj/cq9usk2609YEI=' 
WHERE 
  key_id = '2493947d990b043a829cb17d8a8b26d18ff645918be4b72f6a8c1c9f53969033' 
  AND (
    token = 'gBsTRHapeu+2VTJcDlK40HjfZ6fSj/cq9usk2609YEI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034