UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KBquGN8ia6oFdkjKNyPvZKY2413Zac8nbmGm/y2p1mo=' 
WHERE 
  key_id = '8488012362fd745ea704b1734d57eab597f747a66878613746fe808121302c9f' 
  AND (
    token = 'KBquGN8ia6oFdkjKNyPvZKY2413Zac8nbmGm/y2p1mo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030