UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TOfkIvAxRVtnPYb2Fnd3CLOpvWJrRWF7MIz+d3ky5/k=' 
WHERE 
  key_id = 'b21b88820766ad5d6a5d3675b3ae8849760248033dd30e31ba1cacdb0f075af7' 
  AND (
    token = 'TOfkIvAxRVtnPYb2Fnd3CLOpvWJrRWF7MIz+d3ky5/k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023